<template>
    <div>
        <navigate>查看测评结果</navigate>
        <div class="det_cont">
            <!-- tab切换 -->
            <div class="tab_list dis_flex white_box">
                <div class="item_tab" v-for="(item, index) in tabArr" :key="index" @click="chooseTab(index)"
                    :class="currentTab == index ? 'active_tab' : ''">
                    {{ item }}
                </div>
            </div>

            <!-- 查看测评结果 -->
            <look-done-result v-show="currentTab == 0" :info="info" :type=5></look-done-result>
            <!-- 查看答题情况 -->
            <look-done-statuation v-show="currentTab == 1" ref="lookDoneStatuation" :questionList="questionList"
                :ratingScaleName="info.rating_scale_name" :type=5></look-done-statuation>
        </div>
    </div>
</template>

<script>
import lookDoneResult from "@/views/core/lookDoneResult.vue";
import lookDoneStatuation from "@/views/core/lookDoneStatuation.vue";
import { queryTrainingLectureResult } from '@/api/funcation/training'
export default {
    data() {
        return {
            tabArr: ["查看测评结果", "查看答题情况"],
            currentTab: 0,
            resultId: '',
            info: {},
            questionList: []
        }
    },
    components: {
        "look-done-result": lookDoneResult,
        "look-done-statuation": lookDoneStatuation,
    },
    created() {
        this.resultId = this.$route.query.resultId
        this.getTrainingLectureResult()
    },
    methods: {
        async getTrainingLectureResult() {
            let res = await queryTrainingLectureResult({ id: this.resultId })
            if (res.code == 200) {
                this.info = res.data.info
                this.questionList = res.data.QuestionList
            }
        },
        chooseTab(v) {
            this.currentTab = v;
        },
    }
}
</script>

<style lang="less" scoped>
.tab_list {
    height: 46.67px;
    line-height: 40px;
    margin-bottom: 10px;
    margin: 10px 10px 0 10px;
}

.item_tab {
    flex: 1;
    height: 40px;
    text-align: center;
    font-weight: bold;
    font-size: 14.67px;
}

.active_tab {
    border-radius: 6.67px;
    color: #ffffff;
    background: linear-gradient(0deg, #ffffff -20%, rgba(255, 255, 255, 0) 20%),
        #00aeff;
}
</style>